/*
 * @Descripttion: 
 * @version: 
 * @Author: kl2018
 * @Date: 2019-03-07 20:06:20
 * @LastEditors: kl2018
 * @LastEditTime: 2020-06-23 10:08:11
 */
import { Button } from 'antd';
import { WeaLocaleProvider } from 'ecCom'
const { getLabel } = WeaLocaleProvider
// import {getSelectedRowKeys} from '../util/odocUtil';

/**
 *
 * @param config 包含button配置的一个对象
 * 对象结构如下：
 * {
 *  buttonType：button展示类型
 *  compStore, tableStore, onClick, buttonText
 * }
 */
export default function (config) {
	const { buttonType, compStore, onClick, buttonText } = config;
	const length = compStore.selectRowId.length + "" || "1";
	let btns = [];
	if (buttonText == getLabel('18526', '接收') || buttonText == getLabel('391004', '手工登记') || buttonText == getLabel('510164', "来文登记")) {
		btns = <Button
			disabled={compStore.loading === false ? false : true}
			type={buttonType}
			onClick={() => { onClick() }}
		>
			{buttonText}
		</Button>
	} else {
		btns = <Button
			disabled={length > 0 && compStore.loading === false ? false : true}
			type={buttonType}
			onClick={() => { onClick() }}
		>
			{buttonText}
		</Button>
	}


	return btns;
}